﻿<%@ Page Title="" Language="C#" MasterPageFile="~/main.Master" AutoEventWireup="true" CodeBehind="transactions.aspx.cs" Inherits="comix.transactions" ValidateRequest="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h1>Οι Συναλλαγές μου</h1>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:mainconectionstring %>" 
        
        SelectCommand="SELECT dbo.TRANSACTIONS.trs_id, dbo.TRANSACTIONS.trs_date, dbo.TRANSACTIONS.trs_origin, dbo.TRANSACTIONS.trs_price, dbo.BOOKS.bok_title FROM dbo.TRANSACTIONS INNER JOIN dbo.BOOKS ON dbo.TRANSACTIONS.trs_bok_id = dbo.BOOKS.bok_id WHERE trs_usr_id = @usr_id ORDER BY trs_date DESC" 
        onselecting="SqlDataSource1_Selecting">
        <SelectParameters>
            <asp:Parameter Name="usr_id" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:GridView ID="GridView1" Width="100%" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" BackColor="White" BorderColor="#DEDFDE" 
        BorderStyle="None" BorderWidth="1px" CellPadding="4" DataKeyNames="trs_id" 
        DataSourceID="SqlDataSource1" ForeColor="Black" GridLines="Vertical">
        <RowStyle BackColor="#F7F7DE" />
        <Columns>
            <asp:BoundField DataField="trs_id" HeaderText="Κωδικός Συναλλαγής" ReadOnly="True" 
                SortExpression="trs_id" />
            <asp:BoundField DataField="trs_date" HeaderText="Ημ/νία" 
                SortExpression="trs_date" DataFormatString="{0:d}" />
            <asp:BoundField DataField="bok_title" HeaderText="Τίτλος" 
                SortExpression="bok_title" />                
            <asp:TemplateField HeaderText="Συσκευή" SortExpression="trs_origin">         
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# TransactionType(Eval("trs_origin")) %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="trs_price" HeaderText="Τιμή" 
                SortExpression="trs_price" />
        </Columns>
        <FooterStyle BackColor="#CCCC99" />
        <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
        <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
</asp:Content>
